package com.gy.controller.assistant;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
// 消息表
@Document(collection = "chat_messages")
public class ChatMessages {
    @Id
    private Object memoryId;
    private int messageId;
    private String content;
    private LocalDateTime lastUpdateTime;

    // 保存时自动更新时间
    public void setContent(String content) {
        this.content = content;
        this.lastUpdateTime = LocalDateTime.now(); // 更新内容时自动刷新时间
    }
}
